package io.github.frailty9.crserver.model

import java.time.LocalDateTime
import com.mybatisflex.annotation.Column
import com.mybatisflex.annotation.Id

/**
 * 资源原子单位表
 */
data class ResourceUnit(
    @Id
    override var id: Long? = null,
    /**
     * 关联 resource.id
     */
    var resourceId: Long? = null,
    /**
     * 物理组ID（如场地编号）
     */
    var physicalGroupId: Int? = null,
    /**
     * 组内序号（1,2,...）
     */
    var unitIndex: Int? = null,
    /**
     * 0=已分配，1=空闲
     */
    var status: Int? = null,

    @Column(version = true)
    override var version: Int? = null,

    @Column(onInsertValue = "CURRENT_TIMESTAMP")
    var createTime: LocalDateTime? = null,

    @Column(onInsertValue = "CURRENT_TIMESTAMP", onUpdateValue = "CURRENT_TIMESTAMP")
    var updateTime: LocalDateTime? = null,

    @Column(isLogicDelete = true)
    override var deleted: Int? = null
) : BaseModel
